<?php
 
class Default_Bootstrap extends Zend_Application_Module_Bootstrap
{
	protected function _initRouter() {
		
		$this->bootstrap('frontController');
		$router = $this->getResource('frontController')->getRouter();
		$router->addRoute(
			'post',
			new Zend_Controller_Router_Route('xem-bai-viet/:id',
											 array('controller' => 'post',
												   'action' => 'view'))
		);
		$router->addRoute(
			'postlist',
			new Zend_Controller_Router_Route('moi-nhat/*',
											 array('controller' => 'post',
												   'action' => 'index'))
		);
		$router->addRoute(
			'category',
			new Zend_Controller_Router_Route('danh-muc/:alias/*',
											 array(
												'controller' => 'category',
												'action' => 'list'))
		);	
	}
	protected function _initMysql() {
       
       $dbconf = new Zend_Config_Ini(APPLICATION_PATH . '/configs/database.ini', 'dev');
        $db = Zend_Db::factory($dbconf->database);
        Zend_Db_Table_Abstract::setDefaultAdapter($db); 
        Zend_Registry::set('db',$db);
		
	}
   
	protected function _initActionHelperPaths()
	{
		Zend_Controller_Action_HelperBroker::addPath(
			APPLICATION_PATH .'../library/My/Action/Helper');
	}
	protected function _initViewHelperPaths()
	{
		// $this->bootstrap('view');
		// $view = $this->getResource('view');
		// $view->addHelperPath(APPLICATION_PATH . '/views/helpers', 'Application_View_Helper_');
	}
	
	protected function _initAutoload() {
	
		$autoloader = Zend_Loader_Autoloader::getInstance();
		$autoloader->registerNamespace('My_');

	}
		
}

